<?php
$criteria = new CDbCriteria();
$criteria->order = 'sorter ASC';
$category = ProductCategory::model()->findAllByAttributes(array('status' => 1), $criteria);

if(isset($categoryId) && $categoryId) {
	$product = Product::model()->findAllByAttributes(array('status' => 1, 'product_category_id' => $categoryId));
} else {
	$product = Product::model()->findAllByAttributes(array('status' => 1));
}
?>

<?php if($product): foreach ($product as $p): ?>
<section class="prd-box">
    <div class="pb-hovbox">
        <a href="/product/detail/id/<?php echo $p->id ?>" class="pb-thumb">
            <img src="<?php echo Yii::app()->baseUrl . $p->thumbnail ?>" alt="<?php echo $p->title ?>">
        </a>
        <div class="pb-mask">
            <a href="/product/detail/id/<?php echo $p->id ?>" class="circle-red"><i class="icon-search"></i></a>
        </div>
    </div>
    <div class="pb-caption ftr-list">
        <h2><a href="/product/detail/id/<?php echo $p->id ?>"><?php echo $p->title ?></a></h2>
        <p><?php echo $p->quote ?></p>
        <a href="javascript:void(0)" data-oe-prdid="<?php echo $p->productCategory->id ?>" class="pbc-cattag"><?php echo $p->productCategory->title; ?></a>
    </div>
</section>
<?php endforeach; else: ?>
<div class="prd-box popbox">
    Chưa có sản phẩm nào.
</div>
<?php endif; ?>